package space.sakana.edusysback.controller;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import space.sakana.edusysback.result.Result;
import space.sakana.edusysback.service.TeacherService;

@RestController
@RequestMapping("/api/teacher")
public class TeacherController {

    private TeacherService teacherService;

    @Autowired
    public void autowiredService(TeacherService teacherService){
        this.teacherService = teacherService;
    }

    /**
     * 获取所有Teacher
     */
    @RequestMapping("/all")
    public Result getAllTeachers(HttpServletRequest request, HttpServletResponse response){
        return teacherService.getAllTeacher(request, response);
    }

    /**
     * 添加Teacher
     */
    @RequestMapping("/add")
    public Result getAllTeachers(@RequestParam String data, HttpServletRequest request, HttpServletResponse response){
        return teacherService.addTeacher(data, request, response);
    }

}
